Instrument the Rust backend with Prometheus metrics and create Grafan… - #76
Open
Medo99-olo wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #68
I have successfully instrumented the Rust backend with comprehensive Prometheus metrics and created Grafana dashboards. Here's what was implemented:
Changes Made
1. Dependencies Added (websocket-server/Cargo.toml)
metrics = "0.21"- Core metrics librarymetrics-exporter-prometheus = "0.12"- Prometheus exporteraxum = "0.7"- HTTP server for protected endpointtower = "0.4"andtower-http = "0.5"- Middleware support2. Metrics Module (websocket-server/src/metrics.rs)
Comprehensive instrumentation covering:
3. Protected Metrics Server (websocket-server/src/metrics_server.rs)
/metricsendpointMETRICS_API_KEYenvironment variable4. Integration
5. Grafana Dashboards (
deploy/grafana/)Created 4 pre-configured dashboard templates:
6. Documentation (deploy/grafana/README.md)
Comprehensive guide covering:
Usage
Start the server:
cd websocket-server cargo runAccess metrics:
http://localhost:9090/metricscurl -H "Authorization: Bearer YOUR_KEY" http://localhost:9090/metricsConfigure Prometheus:
Add the WebSocket server as a scrape target pointing to
localhost:9090/metricsImport dashboards:
Upload the JSON files from
deploy/grafana/to your Grafana instance.